[listview] restore scrolling to the top on a second G/End - #1746
Open
nfvelten wants to merge 1 commit into
Open
Conversation
The second press only ever scrolled the last line to the top in the non-selectable branch. Once cursor mode became the default in 7fa4e25, every main view took the selectable branch, which stops after moving the selection, and the behavior disappeared. Give the selectable branch the same second stage: if the selection is already on the last line and it is not at the top yet, scroll it there.
nfvelten
force-pushed
the
fix/end-twice-scrolls-to-top
branch
from
August 31, 2026 23:38
287836c to
c86264a
Compare
Author
|
Sorry about the noise, I force-pushed. The first push accidentally included build artifacts from an in-tree build, since a lot of them are not covered by .gitignore. The branch is now just the one file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1734.
The second press logic only ever existed in the non-selectable branch of the
G/NCKEY_ENDcase:The block itself has not changed. What changed is around it: 7fa4e25 made cursor mode the default, cursor mode calls
set_selectable(true)on the main views, and from then on every press takes the first branch and stops after moving the selection.This gives the selectable branch the same second stage, guarded so it does nothing when the last line is already at the top.
Measured on a 200 line syslog file in an 80x24 terminal, pressing
gthenGthenGand reading back the first visible line:gGGmovement/mode topSo cursor mode now lands on exactly what the old path did, down to the 198 rather than 199, which comes from the view tail space.
One note on reproducing: I only saw the stuck behavior after passing
-c ":config /ui/movement/mode cursor"explicitly. Without it my build behaved like top mode, so the reload delegate that flips the views to selectable did not appear to run on a plain startup here. That may be worth a separate look, but it is not what this patch touches.get_selection()returns an optional, so the check goes throughhas_valuerather than comparing the optional directly. Builds clean, and the only warning inlistview_curses.ccis the pre-existing sign-compare atov_sel >= count.